#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int x = 0;
	int y = 0;
	int z = 0;
	int middle = 0;
	int i = 0;
	int j = 0;
	int arr1[100];
	int arr2[100];
	scanf("%d", &x);
	for (i = 0; i < x; i++)
	{
		scanf("%d", &arr1[i]);
	}
	scanf("%d", &y);
	for (i = 0; i < x; i++)
	{
		if (arr1[i] == y)
		{
			arr1[i] = -1;
		}
	}
	for (i = 0; i < x; i++)
	{
		if (arr1[i] >= 0)
		{
			arr2[z] = arr1[i];
			z++;
		}
	}
	for (i = 0; i < z; i++)
	{
		printf("%d ", arr2[i]);
	}
	return 0;
}